package com.qf.config;

import com.qf.realm.JxcRealm;
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 作者: 王鑫
 * 项目名: jxc1
 * 时间:2019/12/4  20:59
 * 描述:
 */
@Configuration
public class ShiroConfig {
    @Bean
    public DefaultWebSecurityManager securityMjanager(JxcRealm jxcRealm){
        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
        securityManager.setRealm(jxcRealm);
        return securityManager;
    }

    @Bean
    public ShiroFilterChainDefinition chainDefinition(){
        DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
        chainDefinition.addPathDefinition("/**", "anon");
      //  chainDefinition.addPathDefinition("/logout", "logout");
        return chainDefinition;
    }
}
